<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>知行合壹商品展示</title>
    <style>
        * {
            margin: 0;
            padding: 0;
            list-style: none;
        }

        .box {
            width: 500px;
            border: 1px solid #000;
            padding: 10px;
            margin: 50px auto;
        }

        .box ul {
            overflow: hidden;
        }

        .box ul li {
            line-height: 30px;
            float: left;
            width: 150px;
            text-align: center;
        }

        .box p {
            width: 100px;
            border: 1px solid #000;
            padding: 3px;
            margin: 0 auto;

        }
    </style>

    <script src="js/jquery.min.3.4.1.js"></script>


</head>

<body>

    <div class="box">
        <ul>
            <li>佳能</li>
            <li>索尼</li>
            <li>三星</li>
            <li>尼康</li>
            <li>松下</li>
            <li>卡西欧</li>
            <li>富士</li>
            <li>可达</li>
            <li>宾得</li>
            <li>理光</li>
            <li>奥林巴斯</li>
            <li>明基</li>
            <li>显示其它品牌</li>
        </ul>
        <p>显示所有内容</p>

    </div>

    <script>
        $('li:gt(2):not(:last())').toggle();
        var flage = true;
        $('p').click(function () {
            $('li:gt(2):not(:last())').slideToggle();
            if (flage) {
                $(this).html('隐藏所有内容');
                flage = !flage;
            }else {
                $(this).html('显示所有内容');
                flage = !flage;
            }
        })
    </script>

</body>

</html>